import store from 'store'

class storage {
    constructor(key) {
        this.key = key
    }

    get() {
        const item = store.get(this.key)
        return item ? JSON.parse(item) : {}        
    }

    set(data) {
        store.set(this.key, JSON.stringify(data))
    }

    remove() {
        store.remove(this.key)
    }
}

const storeUser = new storage('user_info')
const storeToken = new storage('token')


export {
    storeUser,
    storeToken,
}